package me.jessyan.mvparms.demo.di.module.integral;

import android.view.LayoutInflater;
import android.view.View;

import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.widget.CustomPopupWindow;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

import me.jessyan.mvparms.demo.R;
import me.jessyan.mvparms.demo.mvp.contract.integral.MineScoreContract;
import me.jessyan.mvparms.demo.mvp.model.integral.MineScoreModel;


@Module
public class MineScoreModule {
    private MineScoreContract.View view;

    /**
     * 构建MineScoreModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public MineScoreModule(MineScoreContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    MineScoreContract.View provideMineScoreView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    MineScoreContract.Model provideMineScoreModel(MineScoreModel model) {
        return model;
    }

    @ActivityScope
    @Provides
    CustomPopupWindow signInRulesPop(){
        View content = LayoutInflater.from(view.getActivity())
                .inflate(R.layout.pop_mine_score_choice,null);
        CustomPopupWindow popupWindow = CustomPopupWindow.builder()
                .isFocus(true)
                .isOutsideTouch(true)
                .isWrap(true)
                .contentView(content)

                .customListener(view.getActivity()).build();
        //PopupWindow全屏显示
        popupWindow.setClippingEnabled(false);
        return popupWindow;
    }
}